﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.SharePoint;
using AgileShare.Framework.SiteProvisioning.Helpers;
using AgileShare.Framework.Library.Helpers;
using AgileShare.Framework.Core;

namespace AgileShare.Framework.SiteProvisioning.Definitions
{
	public class SiteDefinition
	{
		/// <summary>
		/// Gets or sets the name.
		/// </summary>
		/// <value>
		/// The name.
		/// </value>
		public string Name { get; set; }

		/// <summary>
		/// Gets or sets the title.
		/// </summary>
		/// <value>
		/// The title.
		/// </value>
		public string Title { get; set; }

		/// <summary>
		/// Gets or sets the description.
		/// </summary>
		/// <value>
		/// The description.
		/// </value>
		public string Description { get; set; }

		/// <summary>
		/// Gets or sets the name of the template.
		/// </summary>
		/// <value>
		/// The name of the template.
		/// </value>
		public string TemplateName { get; set; }

		/// <summary>
		/// Gets or sets the NLCID.
		/// </summary>
		/// <value>
		/// The NLCID.
		/// </value>
		public uint NLCID { get; set; }

		/// <summary>
		/// Gets or sets a value indicating whether [use unique permissions].
		/// </summary>
		/// <value>
		/// <c>true</c> if [use unique permissions]; otherwise, <c>false</c>.
		/// </value>
		public bool UseUniquePermissions { get; set; }

		/// <summary>
		/// Gets or sets a value indicating whether [convert if there].
		/// </summary>
		/// <value>
		///   <c>true</c> if [convert if there]; otherwise, <c>false</c>.
		/// </value>
		public bool ConvertIfThere { get; set; }

		/// <summary>
		/// Gets or sets the site feature ids.
		/// </summary>
		/// <value>
		/// The site feature ids.
		/// </value>
		public List<Guid> SiteFeatureIds { get; set; }

		/// <summary>
		/// Gets or sets the list instance definitions.
		/// </summary>
		/// <value>
		/// The list instance definitions.
		/// </value>
		public List<ListInstanceDefinition> ListInstanceDefinitions { get; set; }

		/// <summary>
		/// Initializes a new instance of the <see cref="SiteDefinition" /> class.
		/// </summary>
		public SiteDefinition()
		{			
			this.ListInstanceDefinitions = new ListInstanceDefinitionCollection();
			this.SiteFeatureIds = new List<Guid>();
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="SiteDefinition" /> class.
		/// </summary>
		/// <param name="name">The name.</param>
		/// <param name="title">The title.</param>
		/// <param name="description">The description.</param>
		/// <param name="templateName">Name of the template.</param>
		/// <param name="nLcid">The n lcid.</param>
		/// <param name="useUniquePermissions">if set to <c>true</c> [use unique permissions].</param>
		/// <param name="convertIfThere">if set to <c>true</c> [convert if there].</param>
		/// <param name="listInstanceDefinitions">The list instance definitions.</param>
		/// <param name="featureIds">The feature ids.</param>
		public SiteDefinition(string name, string title, string description, string templateName, uint nLcid, bool useUniquePermissions, bool convertIfThere, 
			params ListInstanceDefinition[] listInstanceDefinitions) : this()
		{
			this.Name = name;
			this.Title = title;
			this.Description = description;
			this.TemplateName = templateName;
			this.NLCID = NLCID;
			this.UseUniquePermissions = useUniquePermissions;
			this.ConvertIfThere = convertIfThere;
			this.ListInstanceDefinitions = listInstanceDefinitions.ToList();
		}
	}
}
